home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_actor_jaguar.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  112 lines

  1. # Jones 3D Cog Script
  2. #
  3. # actor_Jaguar.cog
  4. #
  5. # [MDR]
  6. #
  7. # Special behavior for jaguars.
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15.     message        created
  16.     message        damaged
  17.     message        aievent
  18.     message        arrivedwpnt
  19.    
  20. # ************************** MISC LOCAL VARS *******************
  21.     int            n_eventType            local
  22.     int            n_crntAIMode        local
  23.     int            n_param                local
  24.  
  25. end
  26.  
  27. # ========================================================================================
  28. code
  29.  
  30. # .................................................................................    
  31. created:
  32.  
  33. #    AISetMode(GetSenderRef(), 0x40000);        # Add SITHAI_MODEINSTINCTUSEWPNTS to jaguar's AI mode 
  34.     AISetSubMode(GetSenderRef(), 0x100000);  // match velocity
  35.     AISetSubMode(GetSenderRef(), 0x20000);  // semi-continuous motion
  36.     return;
  37.  
  38. # .................................................................................    
  39. damaged:
  40.     // Jag can only be killed by instantly fatal attacks, such as explosions
  41.     if (GetParam(0) < GetThingMaxHealth(GetSenderRef()))
  42.     {
  43.         // Heal Jag
  44.         SetHealth(GetSenderRef(), GetThingMaxHealth(GetSenderRef()));
  45.     
  46.         // Flee from Indy
  47.         AIFlee(GetSenderRef(), GetThingParent(GetSourceRef()));
  48.         
  49.         // Return minimal damage so that jag makes sounds.
  50.         ReturnEx(1);
  51.     }
  52.  
  53.     return;
  54.  
  55. # .................................................................................    
  56. aievent:
  57.  
  58.     n_eventType        = GetParam(0);
  59.     n_crntAIMode    = GetParam(1);
  60.     n_param            = GetParam(2);        # Meaning varies according to n_eventType
  61.  
  62.      // ** if SITHAI_EVENTMODECHANGED
  63.     if ( n_eventType == 0x100 )
  64.     {
  65.         // If entered mode SITHAI_MODEFLEEING
  66.         if ( BITTEST(n_crntAIMode, 0x800) && !BITTEST(n_param, 0x800) )
  67.         {
  68.             // Set flag SITH_AF_NOTARGET
  69. //            SetActorFlags(GetSenderRef(), 0x100000);
  70.         }
  71.         // If leaving mode SITHAI_MODEFLEEING
  72.         else if ( !BITTEST(n_crntAIMode, 0x800) && BITTEST(n_param, 0x800) )
  73.         {
  74.             // Clear flag SITH_AF_NOTARGET
  75. //            ClearActorFlags(GetSenderRef(), 0x100000);
  76.         }
  77.     }
  78.     // If reached goal in roam then
  79.     // stop him because he is semicontinuous he would otherwise move again immediately
  80.     else if (n_eventType == 0x800)
  81.     {
  82.         if ( BITTEST(AIGetMode(GetSenderRef()), 0x4) // searching
  83.             && !BITTEST(AIGetMode(GetSenderRef()), 0x800000)) // not hunting
  84.         {
  85.             if (RandBetween(0,100) < 50)
  86.             {
  87. //                DebugPrint("Jaguar Stopped From Actor Cog");
  88.                 StopThing(GetSenderRef());
  89.                 ReturnEx(1); // keep any instinct from handling this event
  90.             }
  91.         }
  92.     }
  93.  
  94.     return;
  95.  
  96. arrivedwpnt:
  97.     if ( BITTEST(AIGetMode(GetSenderRef()), 0x4) // searching
  98.         && !BITTEST(AIGetMode(GetSenderRef()), 0x800000)) // not hunting
  99.     {
  100.         if (RandBetween(0,100) < 50)
  101.         {
  102. //            DebugPrint("Jaguar Stopped From Actor Cog");
  103.             StopThing(GetSenderRef());
  104.             ReturnEx(1); // keep any other instinct from handling this event
  105.         }
  106.     }
  107.  
  108.     return;
  109.  
  110. end
  111.  
  112.